From 06bb0b289b2d2938ba1745a85766b67372b24a40 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 4 Nov 2015 13:20:53 -0800 Subject: [PATCH] Fix install `--path` with a relative path Closes #2106 --- src/bin/install.rs | 4 +--- tests/test_cargo_install.rs | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bin/install.rs b/src/bin/install.rs index 7ae2a130a..db96c81b4 100644 --- a/src/bin/install.rs +++ b/src/bin/install.rs @@ -1,5 +1,3 @@ -use std::path::Path; - use cargo::ops; use cargo::core::{SourceId, GitReference}; use cargo::util::{CliResult, Config, ToUrl, human}; @@ -112,7 +110,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { }; SourceId::for_git(&url, gitref) } else if let Some(path) = options.flag_path { - try!(SourceId::for_path(Path::new(&path))) + try!(SourceId::for_path(&config.cwd().join(path))) } else { try!(SourceId::for_central(config)) }; diff --git a/tests/test_cargo_install.rs b/tests/test_cargo_install.rs index c2835792c..a26c75997 100644 --- a/tests/test_cargo_install.rs +++ b/tests/test_cargo_install.rs @@ -179,6 +179,10 @@ test!(install_path { assert_that(cargo_process("install").arg("--path").arg(p.root()), execs().with_status(0)); assert_that(cargo_home(), has_installed_exe("foo")); + assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()), + execs().with_status(101).with_stderr("\ +binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]` +")); }); test!(multiple_crates_error { -- 2.30.2